<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>人员列表</title>

    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="__PUBLIC__/Theme1/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/newstyle.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>人员列表 <a href="__URL__/add" style="margin-left:15px; color:#06cbc4">添加人员</a></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>

                    <div class="ibox-content">
                        <form method="post" action="__URL__/lists" class="form-horizontal" id="searchForm" enctype="multipart/form-data">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">条件查询：姓名</label>
                                <div class="col-sm-3">
                                    <input type="text" name="stName" id="stName" value="<{$stName}>" class="form-control">
                                </div>
                                <label class="col-sm-1 control-label">身份证号</label>
                                <div class="col-sm-3">
                                    <input type="text" name="stIDCard" id="stIDCard" value="<{$stIDCard}>" placeholder="请输入身份证号" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">性别</label>
                                <div class="col-sm-3">
                                    <label class="checkbox-inline">
                                        <input type="radio" value="1"  name="stSex" <if condition="$stSex eq 1">checked</if> > 男</label>
                                    <label class="checkbox-inline">
                                        <input type="radio" value="2" name="stSex" <if condition="$stSex eq 2">checked</if> > 女</label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label">所属地区</label>
                                <div class="col-sm-7" >
                                    <select class="selectRegione"  name="regione1" >
                                        <php>
                                            if(count($regione1)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione1" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione1id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                    </select>

                                    <select class="selectRegione"  name="regione2" <php>if(empty($regione2)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione2)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione2)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione2" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione2id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>

                                    <select class="selectRegione"  name="regione3" <php>if(empty($regione3)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione3)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione3)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione3" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione3id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>

                                    <select class="selectRegione"  name="regione4" <php>if(empty($regione4)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione4)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione4)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione4" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione4id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>
                                    <!--小组-->
                                    <select class="selectRegione"  name="xiaozu" <php>if(empty($xiaozulist)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($xiaozulist)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($xiaozulist)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="xiaozulist" item="val" key="k">
                                            <option value="<{$val.dId}>" <if condition="$val.dId eq $xiaozu">selected = "selected"</if> ><{$val.dName}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" id="search" type="button">查询</button>
                                    <input type="hidden" name="isDownload" id="isDownload" value="0">
                                    <input name="page" type="hidden" />
                                    <button class="btn btn-primary" id="getExcel" type="button">导出</button>
                                </div>
                            </div>
                        </form>
                    </div>

                    <form method="post" action="__URL__/DelAll" class="form-horizontal" id="form-admin-add">
                    <script type="text/javascript">
                    function CheckAll(val) {
                        $("input[name='node[]']").each(function() {
                            this.checked = val;
                        });
                    }
                    </script>


                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover dataTables-example">

                            <thead>
                                <tr>
                                    <if condition="(session('aPowers') lt 2)"><th></th></if>
                                    <th >姓名</th>
									<th >民语姓名</th>
                                    <th >性别</th>
                                    <th class="dropdown hidden-xs">身份证号</th>
                                    <th class="dropdown hidden-xs">村名称</th>
									<th class="dropdown hidden-xs">小组</th>
                                    <th class="dropdown hidden-xs">房屋编号</th>
									<th class="dropdown hidden-xs">行政区划代码</th>
                                    <if condition="(session('aPowers') lt 2)"> <th class="dropdown hidden-xs">操作</th></if>
                                </tr>
                            </thead>
                            <tbody>
                            <foreach name="rs_staffLists" item="val_staffLists">
                <tr class="text-c">
                    <if condition="(session('aPowers') lt 2)">
                        <td><input type="checkbox" name="node[]" value="<{$val_staffLists.stId}>"></td>
                    </if>

                <td><a href="__URL__/show/stId/<{$val_staffLists.stId}>"><{$val_staffLists.stName}></a></td>
				<td ><{$val_staffLists.nationNanme}></td>
                <if condition="$val_staffLists.stSex eq 1">
                <td>男</td>
                <else/>
                <td>女</td>
                </if>
                <td class="dropdown hidden-xs"><{$val_staffLists.stIDCard}></td>
                <php>
                $regione=M("regione");
				if(!empty($val_staffLists['regioneNum'])){
					$regioneInfo=$regione->where("id={$val_staffLists['regioneNum']}")->find();
				};
                </php>
				<td class="dropdown hidden-xs" ><{$regioneInfo["name"]}></td>

                <php>
                $department=M("department");
				if(!empty($val_staffLists['xiaozu'])){
					$departmentInfo=$department->where("dId={$val_staffLists['xiaozu']}")->find();
				};
                </php>
                <td class="dropdown hidden-xs"><{$departmentInfo.dName}></td>
				 <td class="dropdown hidden-xs"><{$val_staffLists.maisonNum}></td>
				  <td class="dropdown hidden-xs"><{$val_staffLists.regioneNum}></td>


                    <if condition="(session('aPowers') lt 2)">
                <td class="td-manage dropdown hidden-xs">
                
                <a title="编辑人员资料" href="__URL__/update/stId/<{$val_staffLists.stId}>/depId/<{$depId}>"><i class="glyphicon glyphicon-pencil" style="margin-right: 10px;"></i></a>
                
                <a title="删除" onclick="if(confirm('确定删除 <{$val_staffLists.stName}> ?')==false)return false;"  href="__URL__/DelAction/stId/<{$val_staffLists.stId}>" ><i class="glyphicon glyphicon-remove"></i></a>
                
                </td>
                        </if>
            </tr>
            </foreach>
                            </tbody>
                            
                        </table>
                        <div class="page"><{$page}></div>
                        <if condition="(session('aPowers') lt 2)">
                        <input type='checkbox' id='chkAll' onclick="CheckAll(this.checked)"> <span style="margin-right: 10px;color: #2c86da; font-size: 12px; font-weight: bold">全 选</span>
                        <input class="btn btn-success btn-xs" type="submit" value="删除" onclick="if(confirm('确定删除?')==false)return false;">
                        </if>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/jeditable/jquery.jeditable.js"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
    <script>
        function gopage(page){
            $("[name='page']").val(page);
            $("#searchForm").submit();
        };
     $(function(){
         $("#getExcel").click(function(){
             $("#isDownload").val(1);
             $("#searchForm").submit();
         });
         $("#search").click(function(){
             $("#isDownload").val(0);
             $("#searchForm").submit();
         });

         //当第一个选择时，给第二填充数据
         $("[name='regione1']").change(function(){
             $("[name='regione2']").html('<option value="0">加载中...</option>');
             $("[name='regione3']").html('');$("[name='regione3']").hide();
             $("[name='regione4']").html('');$("[name='regione4']").hide();
             $("[name='xiaozu']").html('');$("[name='xiaozu']").hide();
             var id=$(this).val();
             var html='<option value="0">请选择</option>';
             $.ajax({    //ajax方法获取选定区域的下级区域列表
                 url:"/Personnelsystem/Department/getChildId",
                 data:{id:id},
                 dataType:'json',
                 type:'post',
                 success:function(re){
                     var html='<option value="0">请选择</option>';
                     var item=re;
                     for(var i in item){
                         html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                     }
                     $("[name='regione2']").html(html);
                     $("[name='regione2']").show();
                 }
             })
         });
         //当第2个选择时，给第3填充数据
         $("[name='regione2']").change(function(){
             $("[name='regione3']").html('<option value="0">加载中...</option>');
             $("[name='regione4']").html('');$("[name='regione4']").hide();
             $("[name='xiaozu']").html('');$("[name='xiaozu']").hide();
             var id=$(this).val();
             var html='<option value="0">请选择</option>';
             $.ajax({    //ajax方法获取选定区域的下级区域列表
                 url:"/Personnelsystem/Department/getChildId",
                 data:{id:id},
                 dataType:'json',
                 type:'post',
                 success:function(re){
                     var html='<option value="0">请选择</option>';
                     var item=re;
                     for(var i in item){
                         html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                     }
                     $("[name='regione3']").html(html);
                     $("[name='regione3']").show();
                 }
             })
         });
         //当第3个选择时，给第4填充数据
         $("[name='regione3']").change(function(){
             $("[name='regione4']").html('<option value="0">加载中...</option>');
             $("[name='xiaozu']").html('');$("[name='xiaozu']").hide();
             var id=$(this).val();
             var html='<option value="0">请选择</option>';
             $.ajax({    //ajax方法获取选定区域的下级区域列表
                 url:"/Personnelsystem/Department/getChildId",
                 data:{id:id},
                 dataType:'json',
                 type:'post',
                 success:function(re){
                     var html='<option value="0">请选择</option>';
                     var item=re;
                     for(var i in item){
                         html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                     }
                     $("[name='regione4']").html(html);
                     $("[name='regione4']").show();
                 }
             })
         });

         //当选择村时，获取组信息
         $("[name='regione4']").change(function(){
             $("[name='xiaozu']").html('<option value="0">加载中...</option>');
             var id=$(this).val();
             var html='<option value="0">请选择</option>';
             $.ajax({    //ajax方法获取选定区域的下级区域列表
                 url:"/Personnelsystem/Staff/getxiaozuInfo",
                 data:{id:id},
                 dataType:'json',
                 type:'post',
                 success:function(re){
                     var html='<option value="0">请选择</option>';
                     var item=re;
                     for(var i in item){
                         html +='<option value="'+item[i]['dId']+'" >'+item[i]['dName']+'</option>';
                     }
                     $("[name='xiaozu']").html(html);
                     $("[name='xiaozu']").show();
                 }
             })
         });
        })
    </script>
</body>

</html>
